#ifndef MUSICPLAYERWINDOW_H
#define MUSICPLAYERWINDOW_H

#include <QMainWindow>
#include <QSlider>
#include <QDebug>

#include "jsonrpcsocket.h"

class QLabel;

class MusicPlayerWindow : public QMainWindow
{
    Q_OBJECT
public:
    MusicPlayerWindow(QWidget *parent = 0);
    virtual ~MusicPlayerWindow();


public slots:
    void loadTrack();
    void playPause();
    void stop();

    void updatePosition(qint64 pos);
    void updateTimeRange(int min, int max);

    void updateVolume(int volume);

    void updateTrackInformation(QMap<QString, QVariant> metaData);

    void pressSlider(){ v_timeSliderPressed = true; }
    void releaseSlider(){
        QSlider *s = static_cast<QSlider*>(sender());
        v_timeSliderPressed = false;
        p_socket->invokeMethod("MusicController.setPosition(qint64)", s->value());
    }


private:
    JsonRpcSocket *p_socket;


    QSlider *timeSlider;
    QSlider *volumeSlider;
    QLabel *titleLabel;

    bool v_timeSliderPressed;

};

#endif // MUSICPLAYERWINDOW_H
